<%@page import="edu.hcmus.sow.utils.StringUtil"%>
<%@ page language="java" isELIgnored="false" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><jsp:directive.include file="/WEB-INF/sitemesh-decorators/include.jsp" />
<%@page import="org.ocpsoft.pretty.time.PrettyTime"%>
<%@page import="java.util.Date"%>

<c:forEach items="${topics}" var="topic" varStatus="i" >
	<ul class="list list_simple discussionlist">
		<li>
			<div class="fixed">
				<div class="f_left">
					<span class="date"> posted &nbsp;  
						<c:set var="createdDate" value="${topic.createdDate.getTime()}"></c:set>
						<span><%=new PrettyTime().format((Date) pageContext.getAttribute("createdDate"))%></span>
						 by <span>${topic.user.username }</span>
					</span> 
					<span class="date"> <span>${commentsNumber.get(i.count - 1) }</span><a href="${pageContext.request.contextPath}/topic/${topic.id}/view">&nbsp;comment(s)</a>
					</span>
				</div>
				<span> <a class="profileThumb" href=""> <span class="thumbmask"> 
							<span class="topleft"></span> 
							<span class="topright"></span> 
							<span class="bottomleft"></span> 
							<span class="bottomright"></span>
							<img  id="profileImg" src="${pageContext.request.contextPath}/images/default_profile.png">
					</span>
				</a>
				</span>
			</div>
			<div class="fluid">
				<img class="icon" id="type2a0"
					src="${pageContext.request.contextPath}/images/btn_icon_announcement2.png">
				<div class="discussiontitle">
					<a href="${pageContext.request.contextPath}/topic/${topic.id}/view"><span>${topic.title }</span></a> <br>
					<c:set var="content" value="${topic.content }"></c:set> 
					<span>
						<%=StringUtil.removeHTML(StringUtil.subStringToDisplay((String)(pageContext.getAttribute("content")).toString(), 100)) %>
					</span>
				</div>
			</div>
		</li>
	</ul>
	<div class="spacer"></div>
</c:forEach>